package com.atguigu.test;

import com.atguigu.bean.*;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.atguigu.config.MainConifgOfAutowired;
import com.atguigu.dao.BookDao;
import com.atguigu.service.BookService;

public class IOCTest_Autowired {

    @Test
    public void test01() {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConifgOfAutowired.class);

        BookService bookService = applicationContext.getBean(BookService.class);
        System.out.println(bookService);
//		BookDao bean = applicationContext.getBean(BookDao.class);
//		System.out.println(bean);

        Boss boss = applicationContext.getBean(Boss.class);
        System.out.println(boss);
        System.out.println("boss------");

        Car car = applicationContext.getBean(Car.class);
        System.out.println(car);
        System.out.println("car-------");

        Boss2 boss2 = applicationContext.getBean(Boss2.class);
        System.out.println(boss2);
        System.out.println("boss2------");

        Color color = applicationContext.getBean(Color.class);
        System.out.println(color);
        System.out.println(applicationContext);
        applicationContext.close();
    }

}
